(function($) {
    $.fn.pgwMenu = function(options) {
        var defaults = {
            mainClassName: 'pgwMenu',
            dropDownLabel: '<span class="icon"></span>',
            viewMoreEnabled: true,
            viewMoreLabel: 'View more <span class="icon"></span>',
            viewMoreMaxWidth: 480
        };
        if (this.length == 0) {
            return this;
        } else if (this.length > 1) {
            this.each(function() {
                $(this).pgwMenu(options);
            });
            return this;
        }
        var pgwMenu = this;
        pgwMenu.plugin = this;
        pgwMenu.config = {};
        pgwMenu.resizeEvent = null;
        pgwMenu.window = $(window);
        var init = function() {
                pgwMenu.config = $.extend({}, defaults, options);
                setup();
                pgwMenu.checkMenu();
                pgwMenu.window.resize(function() {
                    pgwMenu.plugin.css('overflow', 'hidden');
                    clearTimeout(pgwMenu.resizeEvent);
                    pgwMenu.resizeEvent = setTimeout(function() {
                        pgwMenu.checkMenu();
                    }, 100);
                });
                pgwMenu.plugin.find('.pm-dropDown').click(function(e) {
                    pgwMenu.enableMobileDropDown();
                    e.stopPropagation();
                });
                pgwMenu.plugin.find('.pm-viewMore').click(function(e) {
                    pgwMenu.enableViewMoreDropDown();
                    e.stopPropagation();
                });
                $(document).click(function() {
                    pgwMenu.disableMobileDropDown();
                    pgwMenu.disableViewMoreDropDown();
                });
            };
        var setup = function() {
                var wrapClass = pgwMenu.config.mainClassName;
                var defaultClass = pgwMenu.plugin.attr('class');
                if (defaultClass && defaultClass.indexOf('light') > -1) {
                    wrapClass += ' light';
                }
                pgwMenu.plugin.removeClass().addClass('pm-links');
                pgwMenu.plugin.wrap('<div class="' + wrapClass + '"></div>');
                pgwMenu.plugin = pgwMenu.plugin.parent();
                pgwMenu.plugin.prepend('<div class="pm-dropDown"><a href="javascript:void(0)">' + pgwMenu.config.dropDownLabel + '</a></div>');
                if (pgwMenu.config.viewMoreEnabled) {
                    pgwMenu.plugin.append('<div class="pm-viewMore" style="display:inline-block"><a href="javascript:void(0)">' + pgwMenu.config.viewMoreLabel + '</a><ul></ul></div>');
                }
            };
        pgwMenu.checkMenu = function() {
            var pluginMaxWidth = pgwMenu.plugin.width();
            if (pgwMenu.config.viewMoreEnabled) {
                var viewMoreLinkWidth = pgwMenu.plugin.find('.pm-viewMore').outerWidth(true);
            }
            function getContentWidth() {
                var menuContentWidth = 0;
                pgwMenu.plugin.find('.pm-links').removeClass('mobile').show();
                pgwMenu.plugin.find('.pm-links > li').each(function() {
                    menuContentWidth += $(this).outerWidth(true);
                });
                return menuContentWidth;
            }
            function switchMenu(type) {
                if (type == 'viewmore') {
                    var viewMoreMenuWidth = viewMoreLinkWidth;
                    pgwMenu.plugin.find('.pm-links').removeClass('mobile').show();
                    pgwMenu.plugin.find('.pm-viewMore > ul > li').remove();
                    pgwMenu.plugin.find('.pm-links > li').show().each(function() {
                        if (viewMoreMenuWidth + $(this).outerWidth(true) < pluginMaxWidth) {
                            viewMoreMenuWidth += $(this).outerWidth(true);
                        } else {
                            pgwMenu.plugin.find('.pm-viewMore > ul').append($(this).clone().show());
                            $(this).hide();
                        }
                    });
                    pgwMenu.plugin.find('.pm-dropDown, .pm-viewMore > ul').hide();
                    pgwMenu.plugin.find('.pm-viewMore').show();
                } else if (type == 'dropdown') {
                    pgwMenu.plugin.find('.pm-links > li').show();
                    pgwMenu.plugin.find('.pm-links').addClass('mobile').hide();
                    pgwMenu.plugin.find('.pm-viewMore, .pm-viewMore > ul').hide();
                    pgwMenu.plugin.find('.pm-viewMore > ul > li').remove();
                    pgwMenu.plugin.find('.pm-dropDown').show();
                } else {
                    pgwMenu.plugin.find('.pm-links > li').show();
                    pgwMenu.plugin.find('.pm-links').removeClass('mobile').show();
                    pgwMenu.plugin.find('.pm-dropDown, .pm-viewMore, .pm-viewMore > ul').hide();
                    pgwMenu.plugin.find('.pm-viewMore > ul > li').remove();
                }
                pgwMenu.plugin.find('.pm-dropDown > a, .pm-viewMore > a').removeClass('active');
            }
            if (getContentWidth() > pluginMaxWidth) {
                if (pgwMenu.config.viewMoreEnabled && (pluginMaxWidth > pgwMenu.config.viewMoreMaxWidth)) {
                    switchMenu('viewmore');
                } else {
                    switchMenu('dropdown');
                }
            } else {
                switchMenu('normal');
            }
            pgwMenu.plugin.css('overflow', '');
        };
        pgwMenu.enableViewMoreDropDown = function() {
            if (pgwMenu.plugin.find('.pm-viewMore > a').hasClass('active')) {
                pgwMenu.disableViewMoreDropDown();
                return false;
            }
            pgwMenu.plugin.find('.pm-viewMore > a').addClass('active');
            pgwMenu.plugin.find('.pm-viewMore > ul').show();
        };
        pgwMenu.disableViewMoreDropDown = function() {
            if (pgwMenu.plugin.find('.pm-viewMore > a').hasClass('active')) {
                pgwMenu.plugin.find('.pm-viewMore > a').removeClass('active');
                pgwMenu.plugin.find('.pm-viewMore > ul').hide();
            }
        };
        pgwMenu.enableMobileDropDown = function() {
            if (pgwMenu.plugin.find('.pm-dropDown > a').hasClass('active')) {
                pgwMenu.disableMobileDropDown();
                return false;
            }
            pgwMenu.plugin.find('.pm-dropDown > a').addClass('active');
            pgwMenu.plugin.find('.pm-links').show();
        };
        pgwMenu.disableMobileDropDown = function() {
            if (pgwMenu.plugin.find('.pm-dropDown > a').hasClass('active')) {
                pgwMenu.plugin.find('.pm-dropDown > a').removeClass('active');
                pgwMenu.plugin.find('.pm-links').hide();
            }
        };
        init();
        return this;
    }
})(window.Zepto || window.jQuery);
window.Rainbow = function() {
    function A(a) {
        var b = a.getAttribute("data-language") || a.parentNode.getAttribute("data-language");
        if (!b) {
            var c = /\blang(?:uage)?-(\w+)/;
            (a = a.className.match(c) || a.parentNode.className.match(c)) && (b = a[1])
        }
        return b
    }
    function B(a, b) {
        for (var c in f[d]) {
            c = parseInt(c, 10);
            if (a == c && b == f[d][c] ? 0 : a <= c && b >= f[d][c]) delete f[d][c], delete j[d][c];
            if (a >= c && a < f[d][c] || b > c && b < f[d][c]) return !0
        }
        return !1
    }
    function q(a, b) {
        return '<span class="' + a.replace(/\./g, " ") + (l ? " " + l : "") + '">' + b + "</span>"
    }
    function r(a, b, c, i) {
        if ("undefined" === typeof a || null === a) i();
        else {
            var e = a.exec(c);
            if (e) {
                ++s;
                !b.name && "string" == typeof b.matches[0] && (b.name = b.matches[0], delete b.matches[0]);
                var k = e[0],
                    g = e.index,
                    t = e[0].length + g,
                    h = function() {
                        function e() {
                            r(a, b, c, i)
                        }
                        s % 100 > 0 ? e() : setTimeout(e, 0)
                    };
                if (B(g, t)) h();
                else {
                    var m = u(b.matches),
                        l = function(a, c, i) {
                            if (a >= c.length) i(k);
                            else {
                                var d = e[c[a]];
                                if (d) {
                                    var g = b.matches[c[a]],
                                        f = g.language,
                                        h = g.name && g.matches ? g.matches : g,
                                        j = function(b, d, g) {
                                            var f;
                                            f = 0;
                                            var h;
                                            for (h = 1; h < c[a]; ++h) e[h] && (f = f + e[h].length);
                                            d = g ? q(g, d) : d;
                                            k = k.substr(0, f) + k.substr(f).replace(b, d);
                                            l(++a, c, i)
                                        };
                                    f ? n(d, f, function(a) {
                                        j(d, a)
                                    }) : typeof g === "string" ? j(d, d, g) : v(d, h.length ? h : [h], function(a) {
                                        j(d, a, g.matches ? g.name : 0)
                                    })
                                } else l(++a, c, i)
                            }
                        };
                    l(0, m, function(a) {
                        b.name && (a = q(b.name, a));
                        if (!j[d]) {
                            j[d] = {};
                            f[d] = {}
                        }
                        j[d][g] = {
                            replace: e[0],
                            "with": a
                        };
                        f[d][g] = t;
                        h()
                    })
                }
            } else i()
        }
    }
    function u(a) {
        var b = [],
            c;
        for (c in a) a.hasOwnProperty(c) && b.push(c);
        return b.sort(function(a, c) {
            return c - a
        })
    }
    function v(a, b, c) {
        function i(b, k) {
            k < b.length ? r(b[k].pattern, b[k], a, function() {
                i(b, ++k)
            }) : C(a, function(a) {
                delete j[d];
                delete f[d];
                --d;
                c(a)
            })
        }++d;
        i(b, 0)
    }
    function C(a, b) {
        function c(a, b, i, f) {
            if (i < b.length) {
                ++w;
                var h = b[i],
                    l = j[d][h],
                    a = a.substr(0, h) + a.substr(h).replace(l.replace, l["with"]),
                    h = function() {
                        c(a, b, ++i, f)
                    };
                0 < w % 250 ? h() : setTimeout(h, 0)
            } else f(a)
        }
        var i = u(j[d]);
        c(a, i, 0, b)
    }
    function n(a, b, c) {
        var d = m[b] || [],
            e = m[x] || [],
            b = y[b] ? d : d.concat(e);
        v(a.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/&(?![\w\#]+;)/g, "&amp;"), b, c)
    }
    function o(a, b, c) {
        if (b < a.length) {
            var d = a[b],
                e = A(d);
            return !(-1 < (" " + d.className + " ").indexOf(" rainbow ")) && e ? (e = e.toLowerCase(), d.className += d.className ? " rainbow" : "rainbow", n(d.innerHTML, e, function(k) {
                d.innerHTML = k;
                j = {};
                f = {};
                p && p(d, e);
                setTimeout(function() {
                    o(a, ++b, c)
                }, 0)
            })) : o(a, ++b, c)
        }
        c && c()
    }
    function z(a, b) {
        var a = a && "function" == typeof a.getElementsByTagName ? a : document,
            c = a.getElementsByTagName("pre"),
            d = a.getElementsByTagName("code"),
            e, f = [],
            g = [];
        for (e = 0; e < c.length; ++e) c[e].getElementsByTagName("code").length ? c[e].innerHTML = c[e].innerHTML.replace(/^\s+/, "").replace(/\s+$/, "") : f.push(c[e]);
        for (e = 0; e < d.length; ++e) g.push(d[e]);
        o(g.concat(f), 0, b)
    }
    var j = {},
        f = {},
        m = {},
        y = {},
        d = 0,
        x = 0,
        s = 0,
        w = 0,
        l, p;
    return {
        extend: function(a, b, c) {
            1 == arguments.length && (b = a, a = x);
            y[a] = c;
            m[a] = b.concat(m[a] || [])
        },
        b: function(a) {
            p = a
        },
        a: function(a) {
            l = a
        },
        color: function(a, b, c) {
            if ("string" == typeof a) return n(a, b, c);
            if ("function" == typeof a) return z(0, a);
            z(a, b)
        }
    }
}();
document.addEventListener && document.addEventListener("DOMContentLoaded", Rainbow.color, !1);
Rainbow.onHighlight = Rainbow.b;
Rainbow.addClass = Rainbow.a;
Rainbow.extend([{
    matches: {
        1: [{
            name: "keyword.operator",
            pattern: /\=|\+/g
        }, {
            name: "keyword.dot",
            pattern: /\./g
        }],
        2: {
            name: "string",
            matches: {
                name: "constant.character.escape",
                pattern: /\\('|"){1}/g
            }
        }
    },
    pattern: /(\(|\s|\[|\=|:|\+|\.)(('|")([^\\\1]|\\.)*?(\3))/gm
}, {
    name: "comment",
    pattern: /\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm
}, {
    name: "constant.numeric",
    pattern: /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi
}, {
    matches: {
        1: "keyword"
    },
    pattern: /\b(and|array|as|b(ool(ean)?|reak)|c(ase|atch|har|lass|on(st|tinue))|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi
}, {
    name: "constant.language",
    pattern: /true|false|null/g
}, {
    name: "keyword.operator",
    pattern: /\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g
}, {
    matches: {
        1: "function.call"
    },
    pattern: /(\w+?)(?=\()/g
}, {
    matches: {
        1: "storage.function",
        2: "entity.name.function"
    },
    pattern: /(function)\s(.*?)(?=\()/g
}]);
Rainbow.extend("javascript", [{
    name: "selector",
    pattern: /(\s|^)\$(?=\.|\()/g
}, {
    name: "support",
    pattern: /\b(window|document)\b/g
}, {
    matches: {
        1: "support.property"
    },
    pattern: /\.(length|node(Name|Value))\b/g
}, {
    matches: {
        1: "support.function"
    },
    pattern: /(setTimeout|setInterval)(?=\()/g
}, {
    matches: {
        1: "support.method"
    },
    pattern: /\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g
}, {
    name: "string.regexp",
    matches: {
        1: "string.regexp.open",
        2: {
            name: "constant.regexp.escape",
            pattern: /\\(.){1}/g
        },
        3: "string.regexp.close",
        4: "string.regexp.modifier"
    },
    pattern: /(\/)(?!\*)(.+)(\/)([igm]{0,3})/g
}, {
    matches: {
        1: "storage",
        3: "entity.function"
    },
    pattern: /(var)?(\s|^)(\S*)(?=\s?=\s?function\()/g
}, {
    matches: {
        1: "keyword",
        2: "entity.function"
    },
    pattern: /(new)\s+(.*)(?=\()/g
}, {
    name: "entity.function",
    pattern: /(\w+)(?=:\s{0,}function)/g
}]);
Rainbow.extend("html", [{
    name: "source.php.embedded",
    matches: {
        2: {
            language: "php"
        }
    },
    pattern: /&lt;\?=?(?!xml)(php)?([\s\S]*?)(\?&gt;)/gm
}, {
    name: "source.css.embedded",
    matches: {
        1: {
            matches: {
                1: "support.tag.style",
                2: [{
                    name: "entity.tag.style",
                    pattern: /^style/g
                }, {
                    name: "string",
                    pattern: /('|")(.*?)(\1)/g
                }, {
                    name: "entity.tag.style.attribute",
                    pattern: /(\w+)/g
                }],
                3: "support.tag.style"
            },
            pattern: /(&lt;\/?)(style.*?)(&gt;)/g
        },
        2: {
            language: "css"
        },
        3: "support.tag.style",
        4: "entity.tag.style",
        5: "support.tag.style"
    },
    pattern: /(&lt;style.*?&gt;)([\s\S]*?)(&lt;\/)(style)(&gt;)/gm
}, {
    name: "source.js.embedded",
    matches: {
        1: {
            matches: {
                1: "support.tag.script",
                2: [{
                    name: "entity.tag.script",
                    pattern: /^script/g
                }, {
                    name: "string",
                    pattern: /('|")(.*?)(\1)/g
                }, {
                    name: "entity.tag.script.attribute",
                    pattern: /(\w+)/g
                }],
                3: "support.tag.script"
            },
            pattern: /(&lt;\/?)(script.*?)(&gt;)/g
        },
        2: {
            language: "javascript"
        },
        3: "support.tag.script",
        4: "entity.tag.script",
        5: "support.tag.script"
    },
    pattern: /(&lt;script(?! src).*?&gt;)([\s\S]*?)(&lt;\/)(script)(&gt;)/gm
}, {
    name: "comment.html",
    pattern: /&lt;\!--[\S\s]*?--&gt;/g
}, {
    matches: {
        1: "support.tag.open",
        2: "support.tag.close"
    },
    pattern: /(&lt;)|(\/?\??&gt;)/g
}, {
    name: "support.tag",
    matches: {
        1: "support.tag",
        2: "support.tag.special",
        3: "support.tag-name"
    },
    pattern: /(&lt;\??)(\/|\!?)(\w+)/g
}, {
    matches: {
        1: "support.attribute"
    },
    pattern: /([a-z-]+)(?=\=)/gi
}, {
    matches: {
        1: "support.operator",
        2: "string.quote",
        3: "string.value",
        4: "string.quote"
    },
    pattern: /(=)('|")(.*?)(\2)/g
}, {
    matches: {
        1: "support.operator",
        2: "support.value"
    },
    pattern: /(=)([a-zA-Z\-0-9]*)\b/g
}, {
    matches: {
        1: "support.attribute"
    },
    pattern: /\s(\w+)(?=\s|&gt;)(?![\s\S]*&lt;)/g
}], !0);
(function(a) {
    a.fn.pgwSlideshow = function(q) {
        var i = {
            mainClassName: "pgwSlideshow",//pgwSlideshowLight  pgwSlideshow
            transitionEffect: "fading",// slideing or fading
            displayList: true,
            displayControls: false,
            touchControls: true,
            autoSlide: true,
            beforeSlide: false,
            afterSlide: false,
            maxHeight: null,
            adaptiveDuration: 200,
            transitionDuration: 500,
            intervalDuration: 1000000
        };
        if (this.length == 0) {
            return this
        } else {
            if (this.length > 1) {
                this.each(function() {
                    a(this).pgwSlideshow(q)
                });
                return this
            }
        }
        var j = this;
        j.plugin = this;
        j.config = {};
        j.data = [];
        j.currentSlide = 0;
        j.slideCount = 0;
        j.resizeEvent = null;
        j.intervalEvent = null;
        j.touchFirstPosition = null;
        j.touchListLastPosition = false;
        j.window = a(window);
        var p = function() {
                j.config = a.extend({}, i, q);
                g();
                if (j.config.displayList) {
                    b()
                }
                j.window.resize(function() {
                    clearTimeout(j.resizeEvent);
                    j.resizeEvent = setTimeout(function() {
                        e();
                        var r = j.plugin.find(".ps-current > ul > li.elt_" + j.currentSlide + " img").height();
                        h(r);
                        if (j.config.displayList) {
                            b();
                            n()
                        }
                    }, 100)
                });
                if (j.config.autoSlide) {
                    k()
                }
                return true
            };
        var h = function(r, s) {
                if (j.config.maxHeight) {
                    if (r + j.plugin.find(".ps-list").height() > j.config.maxHeight) {
                        r = j.config.maxHeight - j.plugin.find(".ps-list").height()
                    }
                }
                if (typeof j.plugin.find(".ps-current").animate == "function") {
                    r=j.plugin.find(".ps-current").width()
                    j.plugin.find(".ps-current").stop().animate({
                        height: r
                    }, j.config.adaptiveDuration, function() {
                        if (j.config.maxHeight) {
                            j.plugin.find(".ps-current > ul > li img").css("max-height", r + "px")
                        }
                        else{
                            j.plugin.find(".ps-current > ul > li img").css("max-height", r + "px")
                        }
                    })
                } else {
                    
                    r=Math.round(j.plugin.find(".ps-current").width())
                    j.plugin.find(".ps-current").css("height", r);
                    if (j.config.maxHeight) {
                        j.plugin.find(".ps-current > ul > li img").css("max-height", r + "px")
                    }
                }
                return true
            };
        var c = function() {
                var r = 0;
                j.plugin.show();
                j.plugin.find(".ps-list > ul > li").show().each(function() {
                    r += a(this).width()
                });
                j.plugin.find(".ps-list > ul").width(r);
                return true
            };
        var e = function() {
                if (j.plugin.width() <= 480) {
                    j.plugin.addClass("narrow").removeClass("wide")
                } else {
                    j.plugin.addClass("wide").removeClass("narrow")
                }
                return true
            };
        var g = function() {
                j.plugin.removeClass("pgwSlideshow").removeClass(j.config.mainClassName);
                j.plugin.wrap('<div class="ps-list"></div>');
                j.plugin = j.plugin.parent();
                j.plugin.wrap('<div class="' + j.config.mainClassName + '"></div>');
                j.plugin = j.plugin.parent();
                j.plugin.prepend('<div class="ps-current"><ul></ul><span class="ps-caption"></span></div>');
                j.slideCount = j.plugin.find(".ps-list > ul > li").length;
                if (j.slideCount == 0) {
                    throw new Error("pgwSlideshow - No slider item has been found");
                    return false
                }
                if (j.slideCount > 1) {
                    if (j.config.displayControls) {
                        j.plugin.find(".ps-current").prepend('<span class="ps-prev"><span class="ps-prevIcon"></span></span>');
                        j.plugin.find(".ps-current").append('<span class="ps-next"><span class="ps-nextIcon"></span></span>');
                        j.plugin.find(".ps-current .ps-prev").click(function() {
                            j.previousSlide()
                        });
                        j.plugin.find(".ps-current .ps-next").click(function() {
                            j.nextSlide()
                        })
                    }
                    if (j.config.touchControls) {
                        j.plugin.find(".ps-current").on("touchstart", function(s) {
                            try {
                                if (s.originalEvent.touches[0].clientX && j.touchFirstPosition == null) {
                                    j.touchFirstPosition = s.originalEvent.touches[0].clientX
                                }
                            } catch (s) {
                                j.touchFirstPosition = null
                            }
                        });
                        j.plugin.find(".ps-current").on("touchmove", function(s) {
                            try {
                                if (s.originalEvent.touches[0].clientX && j.touchFirstPosition != null) {
                                    if (s.originalEvent.touches[0].clientX > (j.touchFirstPosition + 50)) {
                                        j.touchFirstPosition = null;
                                        j.previousSlide()
                                    } else {
                                        if (s.originalEvent.touches[0].clientX < (j.touchFirstPosition - 50)) {
                                            j.touchFirstPosition = null;
                                            j.nextSlide()
                                        }
                                    }
                                }
                            } catch (s) {
                                j.touchFirstPosition = null
                            }
                        });
                        j.plugin.find(".ps-current").on("touchend", function(s) {
                            j.touchFirstPosition = null
                        })
                    }
                }
                var r = 1;
                j.plugin.find(".ps-list > ul > li").each(function() {
                    var t = d(a(this));
                    t.id = r;
                    j.data.push(t);
                    a(this).addClass("elt_" + t.id);
                    a(this).wrapInner('<span class="ps-item' + (r == 1 ? " ps-selected" : "") + '"></span>');
                    var s = a('<li class="elt_' + r + '"></li>');
                    if (t.image) {
                        s.html('<img src="' + t.image + '" alt="' + (t.title ? t.title : "") + '">')
                    } else {
                        if (t.thumbnail) {
                            s.html('<img src="' + t.thumbnail + '" alt="' + (t.title ? t.title : "") + '">')
                        }
                    }
                    if (t.link) {
                        s.html('<a href="' + t.link + '"' + (t.linkTarget ? ' target="' + t.linkTarget + '"' : "") + ">" + s.html() + "</a>")
                    }
                    j.plugin.find(".ps-current > ul").append(s);
                    a(this).css("cursor", "pointer").click(function(u) {
                        u.preventDefault();
                        l(t.id)
                    });
                    r++
                });
                if (j.config.displayList) {
                    c();
                    j.plugin.find(".ps-list").prepend('<span class="ps-prev"><span class="ps-prevIcon"></span></span>');
                    j.plugin.find(".ps-list").append('<span class="ps-next"><span class="ps-nextIcon"></span></span>');
                    j.plugin.find(".ps-list").show()
                } else {
                    j.plugin.find(".ps-list").hide()
                }
                if (j.config.autoSlide) {
                    j.plugin.on("mouseenter", function() {
                        clearInterval(j.intervalEvent);
                        j.intervalEvent = null
                    }).on("mouseleave", function() {
                        k()
                    })
                }
                // j.plugin.find(".ps-current > ul > li").hide();  oldCode 调整产品展示页显示 2018.09.19 chs
                j.plugin.find(".ps-current > ul > li").css("display","table");//调整产品展示页显示 2018.09.19 chs
                l(1);
                j.plugin.find(".ps-current > ul > li.elt_1 img").on("load", function() {
                    e();
                    var s = j.plugin.find(".ps-current > ul > li.elt_1 img").height();
                    h(s)
                });
                e();
                j.plugin.show();
                return true
            };
        var d = function(x) {
                var v = {};
                var t = x.find("a").attr("href");
                if ((typeof t != "undefined") && (t != "")) {
                    v.link = t;
                    var u = x.find("a").attr("target");
                    if ((typeof u != "undefined") && (u != "")) {
                        v.linkTarget = u
                    }
                }
                var s = x.find("img").attr("src");
                if ((typeof s != "undefined") && (s != "")) {
                    v.thumbnail = s
                }
                var y = x.find("img").attr("data-large-src");
                if ((typeof y != "undefined") && (y != "")) {
                    v.image = y
                }
                var r = x.find("img").attr("alt");
                if ((typeof r != "undefined") && (r != "")) {
                    v.title = r
                }
                var w = x.find("img").attr("data-description");
                if ((typeof w != "undefined") && (w != "")) {
                    v.description = w
                }
                return v
            };
        var m = function(r) {
                var t = "";
                if (r.title) {
                    t += "<b>" + r.title + "</b>"
                }
                if (r.description) {
                    if (t != "") {
                        t += "<br>"
                    }
                    t += r.description
                }
                if (t != "") {
                    if (r.link) {
                        t = '<a href="' + r.link + '"' + (r.linkTarget ? ' target="' + r.linkTarget + '"' : "") + ">" + t + "</a>"
                    }
                    if (typeof j.plugin.find(".ps-caption").fadeIn == "function") {
                        j.plugin.find(".ps-caption").html(t);
                        j.plugin.find(".ps-caption").fadeIn(j.config.transitionDuration / 2)
                    } else {
                        j.plugin.find(".ps-caption").html(t);
                        j.plugin.find(".ps-caption").show()
                    }
                }
                j.plugin.find(".ps-list > ul > li .ps-item").removeClass("ps-selected");
                j.plugin.find(".ps-list > ul > li.elt_" + r.id + " .ps-item").addClass("ps-selected");
                if (j.config.displayList) {
                    b();
                    n()
                }
                if (j.config.displayControls) {
                    if (typeof j.plugin.find(".ps-current > .ps-prev").fadeIn == "function") {
                        j.plugin.find(".ps-current > .ps-prev, .ps-current > .ps-next").fadeIn(j.config.transitionDuration / 2)
                    } else {
                        j.plugin.find(".ps-current > .ps-prev, .ps-current > .ps-next").show()
                    }
                }
                if (typeof j.config.afterSlide == "function") {
                    j.config.afterSlide(r.id)
                }
                var s = j.plugin.find(".ps-current .elt_" + r.id + " img").height();
                h(s, true);
                return true
            };
        var f = function(u) {
                var t = j.plugin.find(".ps-current > ul");
                t.find("li").not(".elt_" + j.currentSlide).not(".elt_" + u.id).each(function() {
                    if (typeof a(this).stop == "function") {
                        a(this).stop()
                    }
                    // a(this).css("position", "").css("z-index", 1).css("display","table") //oldCode 调整产品显示方式 chs 2018.09.19
                    a(this).css("position", "").css("z-index", 1).css("display","table") //newCcode 调整产品显示方式 chs 2018.09.19
                });
                if (j.currentSlide > 0) {
                    var r = t.find(".elt_" + j.currentSlide);
                    if (typeof r.animate != "function") {
                        r.animate = function(v, w, x) {
                            r.css(v);
                            if (x) {
                                x()
                            }
                        }
                    }
                    if (typeof r.stop == "function") {
                        r.stop()
                    }
                    r.css("position", "absolute").animate({
                        opacity: 0
                    }, j.config.transitionDuration, function() {
                        // r.css("position", "").css("z-index", 1).hide() //oldCode 调整产品显示方式 chs 2018.09.19
                        r.css("position", "").css("z-index", 1).css("display","table") //newCcode 调整产品显示方式 chs 2018.09.19
                    })
                }
                j.currentSlide = u.id;
                var s = t.find(".elt_" + u.id);
                if (typeof s.animate != "function") {
                    s.animate = function(v, w, x) {
                        s.css(v);
                        if (x) {
                            x()
                        }
                    }
                }
                if (typeof s.stop == "function") {
                    s.stop()
                }
                s.css("position", "absolute").show().animate({
                    opacity: 1
                }, j.config.transitionDuration, function() {
                    // s.css("position", "").css("z-index", 2).css("display", "table"); //oldCode 调整产品显示方式 chs 2018.09.19
                    s.css("position", "").css("z-index", 2).css("display", "table");  //newCcode 调整产品显示方式 chs 2018.09.19
                    m(u)
                });
                return true
            };
        var o = function(v, y) {
                var u = j.plugin.find(".ps-current > ul");
                if (typeof y == "undefined") {
                    y = "left"
                }
                if (j.currentSlide == 0) {
                    u.find(".elt_1").css({
                        position: "",
                        left: "",
                        opacity: 1,
                        "z-index": 2,
                        display:"table"
                    });
                    j.plugin.find(".ps-list > li.elt_1").css("opacity", "1");
                    m(v)
                } else {
                    if (j.transitionInProgress) {
                        return false
                    }
                    j.transitionInProgress = true;
                    var x = u.width();
                    if (y == "left") {
                        var r = -x;
                        var w = x
                    } else {
                        var r = x;
                        var w = -x
                    }
                    var s = u.find(".elt_" + j.currentSlide);
                    if (typeof s.animate != "function") {
                        s.animate = function(z, A, B) {
                            s.css(z);
                            if (B) {
                                B()
                            }
                        }
                    }
                    s.css("position", "absolute").animate({
                        left: r
                    }, j.config.transitionDuration, function() {
                        // s.css("position", "").css("z-index", 1).css("left", "").css("opacity", 0).css("display","table") //oldCode 调整产品显示方式 chs 2018.09.19
                        s.css("position", "").css("z-index", 1).css("left", "").css("opacity", 0).css("display","table")  //newCcode 调整产品显示方式 chs 2018.09.19
                    });
                    var t = u.find(".elt_" + v.id);
                    if (typeof t.animate != "function") {
                        t.animate = function(z, A, B) {
                            t.css(z);
                            if (B) {
                                B()
                            }
                        }
                    }
                    t.css("position", "absolute").css("left", w).css("opacity", 1).show().animate({
                        left: 0
                    }, j.config.transitionDuration, function() {
                        t.css("position", "").css("left", "").css("z-index", 2).show();
                        j.transitionInProgress = false;
                        m(v)
                    })
                }
                j.currentSlide = v.id;
                return true
            };
        var l = function(r, t, u) {
                if (r == j.currentSlide) {
                    return false
                }
                var s = j.data[r - 1];
                if (typeof s == "undefined") {
                    throw new Error("pgwSlideshow - The element " + r + " is undefined");
                    return false
                }
                if (typeof u == "undefined") {
                    u = "left"
                }
                if (typeof j.config.beforeSlide == "function") {
                    j.config.beforeSlide(r)
                }
                if (typeof j.plugin.find(".ps-caption").fadeOut == "function") {
                    j.plugin.find(".ps-caption, .ps-prev, .ps-next").fadeOut(j.config.transitionDuration / 2)
                } else {
                    j.plugin.find(".ps-caption, .ps-prev, .ps-next").hide()
                }
                if (j.config.transitionEffect == "sliding") {
                    o(s, u)
                } else {
                    f(s)
                }
                if (typeof t != "undefined" && j.config.autoSlide) {
                    k()
                }
                return true
            };
        var k = function() {
                clearInterval(j.intervalEvent);
                if (j.slideCount > 1 && j.config.autoSlide) {
                    j.intervalEvent = setInterval(function() {
                        if (j.currentSlide + 1 <= j.slideCount) {
                            var r = j.currentSlide + 1
                        } else {
                            var r = 1
                        }
                        l(r)
                    }, j.config.intervalDuration)
                }
                return true
            };
        var b = function() {
                if (!j.config.displayList) {
                    return false
                }
                c();
                var w = j.plugin.find(".ps-list");
                var u = w.width();
                var r = j.plugin.find(".ps-list > ul");
                var v = r.width();
                if (v > u) {
                    r.css("margin", "0 25px");
                    var t = parseInt(r.css("margin-left"));
                    var s = parseInt(r.css("margin-right"));
                    u -= (t + s);
                    w.find(".ps-prev").show().unbind("click").click(function() {
                        var y = parseInt(r.css("left"));
                        var x = y + u;
                        if (y == 0) {
                            x = -(v - u)
                        } else {
                            if (x > 0) {
                                x = 0
                            }
                        }
                        if (typeof r.animate == "function") {
                            r.animate({
                                left: x
                            }, j.config.transitionDuration)
                        } else {

                            r.css("left", x)
                        }
                    });
                    w.find(".ps-next").show().unbind("click").click(function() {
                        var y = parseInt(r.css("left"));
                        var x = y - u;
                        var z = -(v - u);
                        if (y == z) {
                            x = 0
                        } else {
                            if (x < z) {
                                x = z
                            }
                        }
                        if (typeof r.animate == "function") {
                            r.animate({
                                left: x
                            }, j.config.transitionDuration)
                        } else {

                            r.css("left", x)
                        }
                    });
                    if (j.config.touchControls) {
                        j.plugin.find(".ps-list > ul").on("touchmove", function(C) {
                            try {
                                if (C.originalEvent.touches[0].clientX) {
                                    var G = (j.touchListLastPosition == false ? 0 : j.touchListLastPosition);
                                    nbPixels = (j.touchListLastPosition == false ? 1 : Math.abs(G - C.originalEvent.touches[0].clientX));
                                    j.touchListLastPosition = C.originalEvent.touches[0].clientX;
                                    var x = "";
                                    if (G > C.originalEvent.touches[0].clientX) {
                                        x = "left"
                                    } else {
                                        if (G < C.originalEvent.touches[0].clientX) {
                                            x = "right"
                                        }
                                    }
                                }
                                var F = parseInt(r.css("left"));
                                if (x == "left") {
                                    var E = w.width();
                                    var D = r.width();
                                    var z = parseInt(r.css("margin-left"));
                                    var B = parseInt(r.css("margin-right"));
                                    E -= (z + B);
                                    var A = -(D - E);
                                    var y = F - nbPixels;
                                    if (y > A) {
                                        console.log("r")

                                        r.css("left", y)
                                    }
                                } else {
                                    if (x == "right") {
                                        var y = F + nbPixels;
                                        if (y < 0) {

                                            r.css("left", y)
                                        } else {
                                            console.log("r")

                                            r.css("left", 0)
                                        }
                                    }
                                }
                            } catch (C) {
                                j.touchListLastPosition = false
                            }
                        });
                        j.plugin.find(".ps-list > ul").on("touchend", function(x) {
                            j.touchListLastPosition = false
                        })
                    }
                } else {
                    var t = parseInt((u - v) / 2);

                    r.css("left", 0).css("margin-left", t);
                    w.find(".ps-prev").hide();
                    w.find(".ps-next").hide();
                    j.plugin.find(".ps-list > ul").unbind("touchstart touchmove touchend")
                }
                return true
            };
        var n = function() {
                var A = j.plugin.find(".ps-list").width();
                var y = j.plugin.find(".ps-list > ul");
                var z = y.width();
                var t = parseInt(y.css("margin-left"));
                var x = parseInt(y.css("margin-right"));
                A -= (t + x);
                var w = Math.abs(parseInt(y.css("left")));
                var r = w + A;
                var u = j.plugin.find(".ps-list .ps-selected").position().left;
                var s = u + j.plugin.find(".ps-list .ps-selected").width();
                if ((u < w) || (s > r) || (z > A && r > s)) {
                    var v = -(z - A);
                    if (-u < v) {
                        y.css("left", 0)
                        //调整产品展示图显示bug 2018.09.26
                        //oldcord =y.css("left", 0)
                    } else {
                        y.css("left", -u)
                    }
                }
                return true
            };
        j.startSlide = function() {
            j.config.autoSlide = true;
            k();
            return true
        };
        j.stopSlide = function() {
            j.config.autoSlide = false;
            clearInterval(j.intervalEvent);
            return true
        };
        j.getCurrentSlide = function() {
            return j.currentSlide
        };
        j.getSlideCount = function() {
            return j.slideCount
        };
        j.displaySlide = function(r) {
            l(r, true);
            return true
        };
        j.nextSlide = function() {
            if (j.currentSlide + 1 <= j.slideCount) {
                var r = j.currentSlide + 1
            } else {
                var r = 1
            }
            l(r, true, "left");
            return true
        };
        j.previousSlide = function() {
            if (j.currentSlide - 1 >= 1) {
                var r = j.currentSlide - 1
            } else {
                var r = j.slideCount
            }
            l(r, true, "right");
            return true
        };
        j.destroy = function(r) {
            clearInterval(j.intervalEvent);
            if (typeof r != "undefined") {
                j.plugin.find(".ps-list > ul > li").each(function() {
                    a(this).attr("style", null).removeClass().unbind("click");
                    a(this).html(a(this).find("span").html())
                });
                j.plugin.find(".ps-current").remove();
                j.plugin.find(".ps-list").find(".ps-prev, .ps-next").remove();
                j.plugin.find(".ps-list > ul").addClass(j.config.mainClassName).attr("style", "");
                j.plugin.find(".ps-list > ul").unwrap().unwrap();
                j.hide()
            } else {
                j.parent().parent().remove()
            }
            j.plugin = null;
            j.data = [];
            j.config = {};
            j.currentSlide = 0;
            j.slideCount = 0;
            j.resizeEvent = null;
            j.intervalEvent = null;
            j.touchFirstPosition = null;
            j.window = null;
            return true
        };
        j.reload = function(r) {
            j.destroy(true);
            j = this;
            j.plugin = this;
            j.window = a(window);
            j.plugin.show();
            j.config = a.extend({}, i, r);
            g();
            j.window.resize(function() {
                clearTimeout(j.resizeEvent);
                j.resizeEvent = setTimeout(function() {
                    e();
                    var s = j.plugin.find(".ps-current > ul > li.elt_" + j.currentSlide + " img").css("max-height", "").height();
                    h(s);
                    if (j.config.displayList) {
                        b();
                        n()
                    }
                }, 100)
            });
            if (j.config.autoSlide) {
                k()
            }
            return true
        };
        p();
        return this
    }
})(window.Zepto || window.jQuery);

// $('.pgwMenu').pgwMenu();

var pgwSlideshow = $('.pgwSlideshow').pgwSlideshow();

// function reloadSlideshow() {
//     var newConfig = {};
//     var style = $('input[name=\"style\"]:checked').val();
//     if (style == 'light') {
//         newConfig.mainClassName = 'pgwSlideshowLight';
//     }
//     var listPosition = $('input[name=\"listPosition\"]:checked').val();
//     if (listPosition == 'none') {
//         newConfig.displayList = false;
//     } else {
//         newConfig.listPosition = listPosition;
//     }
//     newConfig.transitionEffect = $('input[name=\"transitionEffect\"]:checked').val();
//     if ($('#displayList:checked').val() == 'true') {
//         newConfig.displayList = true;
//     } else {
//         newConfig.displayList = false;
//     }
//     if ($('#displayControls:checked').val() == 'true') {
//         newConfig.displayControls = true;
//     } else {
//         newConfig.displayControls = false;
//     }
//     if ($('#maxHeight:checked').val() == 'true') {
//         newConfig.maxHeight = 450;
//     }
//     pgwSlideshow.reload(newConfig);
// }
// $('.slideshowConfig input').bind('change', function() {
//     reloadSlideshow()
// });